using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Input.Touch;
using Microsoft.Xna.Framework.Graphics;

namespace amazingfishing.sprites
{
    public class Winder:Sprite
    {
        public Winder(Texture2D _img, Vector2 _position)
            : base(_img, _position)
        {
        }

        public Winder(Texture2D _img, Vector2 _position, Point _frameSize, Point _sheetSize, int _timeperFrame)
            : base(_img, _position, _frameSize, _sheetSize, _timeperFrame)
        {
        }

        public bool checkHold(Vector2 holdPosition)
        {
            if (StaticFunctions.IsInRectangle(holdPosition, CollisionRect()))
            {
                nextFrame();
                return true;
            }
            else
            {
                return false;
            }
        }

        public override void Update(GameTime gameTime)
        {
        }

        protected void nextFrame()
        {
            ++currentFrame.X;
            if (currentFrame.X >= sheetSize.X)
            {
                currentFrame.X = 0;
                ++currentFrame.Y;
                if (currentFrame.Y >= sheetSize.Y)
                    currentFrame.Y = 0;
            }
        }
        protected void lastFrame()
        {
            --currentFrame.X;
            if (currentFrame.X < 0)
            {
                currentFrame.X = sheetSize.X - 1;
                --currentFrame.Y;
                if (currentFrame.Y < 0)
                    currentFrame.Y = sheetSize.Y - 1;
            }
        }
    }
}
